import base64

def encode(str):
    return base64.b64encode(bytes(str,"utf-8"))

def main():
    flag = True
    while flag:
        id = input("输入需要更改的id:")
        method = input("输入需要进行的操作：（'-'代表加入概率减少人员组，'+'代表加入概率增加人员组，'0'代表删除该人员）")
        command = ""
        if method == "-" or method == "——":
            command = id + ",-"
        elif method == "+":
            command = id + ",+"
        elif method == "0":
            command = id + ",0"
        else:
            print("指令语法错误，请检查输入指令是否满足要求")
            continue
        print("密文已生成:" + encode(command).decode("utf-8"))
        with open("config.data",mode = "a",encoding="utf-8") as config:
            config.write(encode(command).decode("utf-8") + "\n")
        print("密文已写入./config.data文件中")
        command = input("是否继续录入？(Y/N)：")
        if not (command == "Y" or command == "y"):
            flag = False

if __name__ == "__main__":
    main()